<script type="text/ng-template" id="page.module.eidt.html">
    <input type="file" style="display:none;" id="fileuploader" />
    <form ng-init="init()">
        <div class="modal-header">
            <h3 class="modal-title">模块编辑</h3>
        </div>
        <div class="modal-body">
            <div class="form-horizontal">
                <div class="form-group">
                    <label for="description" class="col-sm-2 control-label">模块描述信息</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" ng-model="moduleConfig.description" autofocus onfocus="this.select()">
                    </div>
                </div>
                <hr/>
                <div ng-if="showDetail">
                    <div class="form-group">
                        <label for="moduleTitle" class="col-sm-2 control-label">前台标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="moduleConfig.moduleTitle">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="moduleSubTitle" class="col-sm-2 control-label">前台副标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" ng-model="moduleConfig.moduleSubTitle">
                        </div>
                    </div>
                </div>
                <div ng-if="!showDetail">
                    <div class="form-group">
                        <label for="headType" class="col-sm-2 control-label">标题布局</label>
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="moduleConfig.headType">
                                <option value="LEFT" label="左对齐" selected></option>
                                <option value="CENTER" label="居中"></option>
                            </select>
                        </div>
                        <label for="moduleTitle" class="col-sm-2 control-label">前台标题</label>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" ng-model="moduleConfig.moduleTitle">
                        </div>
                        <label for="moduleSubTitle" class="col-sm-2 control-label">前台副标题</label>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" ng-model="moduleConfig.moduleSubTitle">
                        </div>
                    </div>
                    <div class="form-group" ng-if="moduleConfig.headType=='LEFT'">
                        <label for="rightLink" class="col-sm-2 control-label">链接</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" ng-model="moduleConfig.rightLink">
                        </div>
                        <label for="moduleLogo" class="col-sm-2 control-label">LOGO</label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <input type="text" class="form-control" ng-model="moduleConfig.moduleLogo">
                                <span class="input-group-btn">
                                    <button class="btn btn-default" ng-click="changeFile('moduleLogo')" tabindex="0">
                                    <i class="glyphicon glyphicon-folder-open"></i>
                                    </button>
                                    <button class="btn btn-success" tabindex="0" ng-if="isModuleLogoCompleted">
                                    <i class="glyphicon glyphicon-ok"></i>
                                    </button>
                                </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="moduleTitle" class="col-sm-2 control-label">简短描述</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" ng-model="moduleConfig.shortDescription">
                        </div>
                        <label for="moduleSubTitle" class="col-sm-2 control-label">特殊内容</label>
                        <div class="col-sm-4">
                            <input type="text" class="form-control" ng-model="moduleConfig.specialContent">
                        </div>
                    </div>
                    <hr/>
                    <div class="form-group">
                        <label for="backgroundColor" class="col-sm-2 control-label">模块背景色</label>
                        <div class="col-sm-4">
                            <input type="color" class="form-control" ng-model="moduleConfig.style.backgroundColor">
                        </div>
                        <label for="backgroundUrl" class="col-sm-2 control-label">模块填充图</label>
                        <div class="col-sm-4">
                            <div class="input-group">
                                <input type="text" class="form-control" ng-model="moduleConfig.style.backgroundUrl">
                                <span class="input-group-btn">
                                <button class="btn btn-default" ng-click="changeFile('moduleBackgroundUrl')" tabindex="0">
                                <i class="glyphicon glyphicon-folder-open"></i>
                                </button>
                                <button class="btn btn-success" tabindex="0" ng-if="isBackgroundUrlCompleted">
                                <i class="glyphicon glyphicon-ok"></i>
                                </button>
                            </span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="marginBottom" class="col-sm-2 control-label">模块底边距(-1使用默认)</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" placeholder="-1" ng-model="moduleConfig.style.marginBottom">
                        </div>
                        <label class="col-sm-1">px</label>
                        <label for="border" class="col-sm-2 control-label">边框像素量(-1使用默认)</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" placeholder="-1" ng-model="moduleConfig.style.border">
                        </div>
                        <label class="col-sm-1">px</label>
                    </div>
                    <div class="form-group">
                        <label for="border" class="col-sm-2 control-label">轮播</label>
                        <div class="col-sm-3">
                            <select class="form-control" ng-model="moduleConfig.canSlide" ng-options="o.v as o.n for o in [{ n: '否', v: false }, { n: '是', v: true }]">
                            </select>
                        </div>
                        <label for="border" class="col-sm-2 control-label">分类</label>
                        <div class="col-sm-3">
                            <select class="form-control" ng-model="moduleConfig.bucket">
                            <option value="" label="空" selected></option>
                                <option value="CATAGORY" label="分类主题"></option>
                                <option value="NATION" label="国家主题"></option>
                                <option value="CROWD" label="人群主题"></option>
                                <option value="BRAND" label="品牌"></option>
                                <option value="YOUQU" label="有趣"></option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="border" class="col-sm-2 control-label">轮播间隔(秒)</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" ng-model="moduleConfig.slideTime" value="3600"/>
                        </div>
                    </div>
                </div>
                <div ng-repeat="(key, submodule) in moduleDetail.cmsSubModuleList">
                    <hr/>
                    <div class="form-group">
                        <label for="moduleSubTitle" class="col-sm-2 control-label">{{submodule.description}}</label>
                        <div class="col-sm-10">
                            <select class="form-control" ng-model="moduleConfig.moduleSubModuleConfigs[key].processorBeanName" ng-options="processor.beanName as processor.description for processor in submodule.cmsDataProcessor" ng-change="changeProcssor(moduleConfig.moduleSubModuleConfigs[key],submodule.cmsDataProcessor)">
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-6" ng-repeat="paramInfo in moduleConfig.moduleSubModuleConfigs[key].paramInfos">
                            <label class="col-sm-6 control-label">{{paramInfo.description}}</label>
                            <div class="col-sm-6">
                                <input type="text" class="form-control" autofocus ng-model="paramInfo.value">
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button class="btn btn-default" type="submit" ng-if="showDetail" ng-click="showDetail()">更多设置</button>
            <button class="btn btn-success" type="submit" ng-click="ok()">保存</button>
            <button class="btn btn-default" ng-click="cancel()">取消</button>
        </div>
    </form>
</script>
